package work.xiaohong.arithmetic.IO;

import lombok.Cleanup;
import work.xiaohong.arithmetic.entity.User;

import java.io.*;

/**
 * @author xiaohong
 * @version 1.0
 * @date 2021/10/27 0027 13:06
 * @description 打印流 支持数据原样打印
 */
public class PrintReaderAndPrintWriter {

    public static void main(String[] args) throws Exception {
        writeFile();
    }

    // 写入字符
    public static void writeFile() throws Exception {
        @Cleanup
        PrintWriter printWriter = new PrintWriter("a.txt");

        printWriter.println(123);
        printWriter.print("是");
        printWriter.println(new User("xiaohong",18));
        printWriter.println("a");
        printWriter.flush();

    }





}
